#include <bits/stdc++.h>

using namespace std;
#define LL long long

const int N = 2e5 + 10;
LL n, m ;
LL a[N];
LL sum[N],psum[N];


bool check(int x){
	
	for(int i=1;i+x-1<=n;i++){
		double p1=psum[i+x-1]-psum[i-1];  // 得到平方和
		double p2=sum[i+x-1]-sum[i-1];  
		double p=p2/x;                     // 平均值
		double ans=p1-p*p*x;
        // cout << "p*p2:" << p*p2 <<" p*p*x" << p*p*x << '\n';
		if(ans<=m) return true;
	}
	return false;
}


int main()
{
    cin >> n >> m;
    for(int i = 1; i<=n ;i++) cin >> a[i];
    sort(a+1,a+1+n);

    for(int i = 1; i <= n;i++){
        sum[i] = sum[i-1] + a[i];
        psum[i] = psum[i -1] + a[i] * a[i];
    }
    
    // 进行二分（其中剩余的长度）
    int l = 0, r = n+1, ans = 1;
    while(l < r){
        int mid = l + r >> 1;
        if(check(mid))  ans = mid,l = mid + 1;
        else r = mid;
    }
    cout << n - ans;
   return 0;
}
